#include <iostream>
using namespace std;
int jiech ( int n)//shengming bing dingyi yige shu de chengjie.
{
	int s=1;
	for (int i = 1; i <= n; i++)
	{
		s = s * i;
	}
	return s;
}

int main()
{
		char inquiry;
		do 
		{
			int n,a = 0;
		  
			cout << " ni yao 1 dao ji de jiecheng?" << endl;
	        cin >> n;
	        for ( int i = 1; i <= n; i++)
	        {
		        a += jiech(i);
	        }
	        cout << a << endl;
	        cout << " haiyao zai suan yici ma?(on is stop)" << endl;
	        cin >> inquiry;
		}while( inquiry != 'N' && inquiry != 'n');
		return 0;
}
